/* 
 * Copyright (C) 2012 Mark Thompson (mark.artifice@gmail.com)
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *  
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *  
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package com.artificetech.videolibrary.metadata;

import java.util.Date;

import com.artificetech.videolibrary.GalleryViewable;

import android.graphics.Bitmap;
import android.net.Uri;

/**
 * The metadata fields that the gallery currently considers.
 */
public class VideoData implements GalleryViewable {
	/**
	 * Rather than keeping images in memory, providers implement this interface to load them on demand.
	 */
	public interface ArtProvider {
		public Bitmap get();
	}

	// The URI if this video.
	public final Uri uri;
	
	// The reported mime-type of this video.
	public final String mimeType;
	
	// The location of this video in the filesystem.
	public final String path;

	public String title;
	public String titleSort;
	
	public int duration; // ms
	public Date releaseDate; // or date created
	public String description;
	public String genre;
	public String cast;
	public String director;
	public ArtProvider coverArt; // This is the image used in the gallery.
	
	VideoData(Uri _uri, String _mimeType, String _path) {
		uri=_uri; mimeType=_mimeType; path=_path;
	}
	
	public Bitmap getCoverArt() {
		if (coverArt!=null) return coverArt.get();
		return null;
	}
	
	public String toString() { return title; }
}
